וַֽיְהִי֙ מִסְפַּ֣ר הַיָּמִ֔ים אֲשֶׁר־יָשַׁ֥ב דָּוִ֖ד בִּשְׂדֵ֣ה פְלִשְׁתִּ֑ים יָמִ֖ים וְאַרְבָּעָ֥ה חֳדָשִֽׁים׃
And the number of the days that David dwelt in the country of the Philistines was a full year and four months.
Read halakhic rulings (Jewish law) on I Samuel 27:7: and classical halakhic sources.